package com.partvoyage.server.utils;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class Configuration {
	private static Configuration INSTANCE;

	private final Properties properties;

	// private final Logger log = Logger.getLogger(getClass().getName());

	private Configuration() {
		System.out.println("Configuration():: start");
		this.properties = new Properties();

		try {
			properties.load(new FileInputStream(System
					.getProperty("partenairevoyage.configuration.file")));
		} catch (IOException ioex) {
			throw new RuntimeException(ioex);
		}

		System.out.println("Configuration():: exit");
	}

	private Properties getProperties() {
		return properties;
	}

	public static void load() {
		INSTANCE = new Configuration();
	}

	public static String getHomeUrl() {
		return INSTANCE.getProperties().getProperty("homeUrl");
	}

	public static String getApplicationName() {
		return INSTANCE.getProperties().getProperty("applicationName");
	}

	public static String getConsumerToken() {
		return INSTANCE.getProperties().getProperty("consumerToken");
	}

	public static String getConsumerTokenSecret() {
		return INSTANCE.getProperties().getProperty("consumerTokenSecret");
	}

	public static String getGooglePlusApiKey() {
		return INSTANCE.getProperties().getProperty("googleplus.api.key");
	}
	
	public static String getGooglePlusClientId() {
		return INSTANCE.getProperties().getProperty("googleplus.client.id");
	}
	
	public static String getGeonameUserName() {
		return INSTANCE.getProperties().getProperty("geoname.username");
	}
}
